<?php

class SearchController extends Controller
{

    public function actionIndex()
    {
	$q = Yii::app()->getRequest()->getParam('q');
	$page = Yii::app()->getRequest()->getParam('page', 1);
	$offset = ($page - 1) * Yii::app()->params['perPage'];
	$data = FactoryService::get('search')->search($q, $offset, Yii::app()->params['perPage']);
	$this->breadcrumbs = array(
	    'Поиск'
	);
	$this->render('index', array('data' => $data, 'query' => $q, 'page' => $page));
    }

}
